package com.gome.axwl.aoc.service.impl;

import com.gome.axwl.aoc.dao.DeviceDao;
import com.gome.axwl.aoc.entity.po.DeviceMsgPo;
import com.gome.axwl.aoc.entity.po.DevicePo;
import com.gome.axwl.aoc.service.DeviceService;
import com.gome.datasource.shard.annotation.ReadDatasource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 登录设备管理
 * @Auther: chengh
 * @Date: 2018/4/25 13:59
 */
@Service("deviceService")
public class DeviceServiceImpl implements DeviceService {

    private final static Logger log = LoggerFactory.getLogger(DeviceServiceImpl.class);

    @Autowired
    private DeviceDao deviceDao;

    /**
     * 查询
     *
     * @param devicePo
     * @return
     */
    @ReadDatasource
    @Override
    public DevicePo selectSelective(DevicePo devicePo) {
        return deviceDao.selectSelective(devicePo);
    }

    /**
     * 插入
     * @param devicePo
     */
    @Override
    public void insert(DevicePo devicePo) {
        deviceDao.insert(devicePo);
    }

    /**
     * 根据员工编号删除设备登录记录
     *
     * @param EmpNo
     */
    @Override
    public void deleteByEmpNo(String EmpNo) {
        deviceDao.deleteByEmpNo(EmpNo);
    }

    /**
     * 根据cid更新
     * @param devicePo
     */
    @Override
    public void updateByCid(DevicePo devicePo) {
        deviceDao.updateByCid(devicePo);
    }

    /**
     * 查询全部的设备
     * @return
     */
    @ReadDatasource
    @Override
    public List<DevicePo> selectAllBySysType(Integer type) {
        return deviceDao.selectAllBySysType(type);
    }

    /**
     * 根据driverIds查询用户的登录设备信息集合
     * @param driverIds
     * @return
     */
    @ReadDatasource
    @Override
    public List<DeviceMsgPo> getDeviceInfoByDriverIds(List<String> driverIds) {
        return deviceDao.getDeviceInfoByDriverIds(driverIds);
    }

    /**
     * 分页查询设备信息
     * @return
     */
    @ReadDatasource
    @Override
    public List<DeviceMsgPo> getDeviceInfoByPage() {
        return deviceDao.getDeviceInfoByPage();
    }


}
